﻿IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[FK_FlashCards_Explanations]') AND parent_object_id = OBJECT_ID(N'[FlashCards]'))
ALTER TABLE [FlashCards] DROP CONSTRAINT [FK_FlashCards_Explanations]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[FlashCards]') AND type in (N'U'))
DROP TABLE [FlashCards]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [FlashCards](
	[FlashCardID] [int] IDENTITY(1,1) NOT NULL,
	[ExplanationID] [int] NOT NULL,
	[DealersUpCard] [nvarchar](10) NOT NULL,
	[PlayersHand] [nvarchar](200) NOT NULL,
	[CorrectResponse] [int] NOT NULL,
	[ToughHand] [bit] NOT NULL,
 CONSTRAINT [PK_FlashCards] PRIMARY KEY CLUSTERED 
(
	[FlashCardID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [FlashCards]  WITH CHECK ADD  CONSTRAINT [FK_FlashCards_Explanations] FOREIGN KEY([ExplanationID])
REFERENCES [Explanations] ([ExplanationID])
GO

ALTER TABLE [FlashCards] CHECK CONSTRAINT [FK_FlashCards_Explanations]
GO

